#pragma once

#include "cv.h"
#include "Blob.h"
#include "Position.h"

class ImageProcessor
{
private:
	uchar* data;
	int width;
	int height;
	int step;
	int channels;
	int** blobField;
	int** countField;
	double loweredRatio;
	double raisedRatio;
	Blob redBlob;
	Blob greenBlob;
	Blob blueBlob;
	Blob pedalBlob;
	double conversionR;
	double conversionG;
	double conversionB;
	int pixelCount;

	Position upperLeft;
	Position upperRight;
	Position lowerLeft;
	Position lowerRight;

public:
	ImageProcessor(IplImage* sample);
	void processImage(IplImage* image);
	~ImageProcessor(void);
	const static int RED = 1;
	const static int GREEN = 2;
	const static int BLUE = 3;
	const static int SKIN = 4;
	const static int COLOR_COUNT = 5;
	const static int PIXEL_THRESHOLD = 250;
	//void Calibrate(IplImage* image);

	void calibrateStep(int step);

	Blob* getRedBlob() {return &redBlob;}
	Blob* getGreenBlob() {return &greenBlob;}
	Blob* getBlueBlob() {return &blueBlob;}
	Blob* getPedalBlob() {return &pedalBlob;}

	Position* getUpperLeft() {return &upperLeft;}
	Position* getUpperRight() {return &upperRight;}
	Position* getLowerLeft() {return &lowerLeft;}
	Position* getLowerRight() {return &lowerRight;}

	bool getPedalLowered(double rat);
};

